using System;
using System.Collections.Generic;
using System.Text;
using DoAn_LyThuyet.HeThongXuLy;

namespace DoAn_LyThuyet.HeThongLuuTru
{
    class TiepNhanTaiSanBUS
    {
        //----------bus loai tai san----------------
        public static bool ThemLoai(TiepNhanTaiSanDTO lts)
        {
            if (TiepNhanTaiSanDAO.SelectTLByName(lts.MaLoai) == null)
            {
                TiepNhanTaiSanDAO.Insert(lts);
                return true;
            }
            else
            {
                return false;
            }
        }
        public static bool XoaLoai(TiepNhanTaiSanDTO lts)
        {
            if (TiepNhanTaiSanDAO.SelectTLByCode(lts.MaLoai) != null)
            {
                TiepNhanTaiSanDAO.Delete(lts);
                return true;
            }
            else
            {
                return false;
            }
        }
        //'-------------bus-tai san---------
        public static bool ThemTaiSan(TiepNhanTaiSanDTO s)
        {
            if (TiepNhanTaiSanDAO.SelectTS(s.MaTaiSan) == null)
            {
                TiepNhanTaiSanDAO.Insertts(s);
                return true;
            }
            else
            {
                return false;
            }
        }
        public static bool XoaTaiSan(TiepNhanTaiSanDTO xts)
        {
            if (TiepNhanTaiSanDAO.SelectTS(xts.MaTaiSan) != null)
            {
                TiepNhanTaiSanDAO.Deletets(xts);
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
